﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Core;

namespace DAL
{
    public class StudentNoteProblemDAL : SyncBase<Model.StudentNoteProblem>
    {
        static StudentNoteProblemDAL()
        {
            StringBuilder strSql = new StringBuilder();
            StudentNoteProblemDAL.addSQL = @"insert into TempStudentNoteProblem(
ArrangeID,StudentID,UserName,CreateTime,Rtype,RecordContent,ContentURL,FileType,ReType,ResourceID,DoubtTime)
 values (
@ArrangeID,@StudentID,@UserName,@CreateTime,@Rtype,@RecordContent,@ContentURL,@FileType,@ReType,@ResourceID,@DoubtTime)";
            StudentNoteProblemDAL.tbName = "TempStudentNoteProblem";
            StudentNoteProblemDAL.remoteUrl = "/Ayyfford/AddStudentNoteProblem";
            StudentNoteProblemDAL.setVal = (lt) =>
            {
                StringBuilder sb = new StringBuilder();
                string _ids = string.Empty;
                if (lt != null && lt.Count > 0)
                {
                    lt.ForEach(t =>
                    {
                        _ids += t.ID + ",";
                        sb.AppendFormat("({0}, {1}, {2}, {3}, {4}, {5}, {6},{7},{8}, {9}, {10}),",
                           t.ArrangeID.NullNumber(), t.StudentID.NullNumber(), t.UserName.NullString(), t.CreateTime.NullDate(), t.Rtype.NullNumber(), t.RecordContent.NullString(), t.ContentURL.NullString(), t.FileType.NullNumber(), t.ReType.NullNumber(), t.ResourceID.NullNumber(), t.DoubtTime.NullNumber());
                    });
                }
                return new Tuple<string, string>(sb.ToString(), _ids);
            };
        }

        new public static void SaveEntity(Model.StudentNoteProblem t)
        {
            SyncBase<Model.StudentNoteProblem>.SaveEntity(t);
        }

        new public static void AsyncData()
        {
            SyncBase<Model.StudentNoteProblem>.AsyncData();
        }
    }
}
